home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / MOD1-3.C < prev    next >
C/C++ Source or Header  |  1993-06-10  |  3KB  |  102 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville, MI
  3. Date: 06-06-93 (11:27)             Number: 219
  4. From: DANIEL LYNES                 Refer#: NONE
  5.   To: MATTHEW O'CONNOR              Recvd: NO  
  6. Subj: Mod File Routines 3/4          Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8.  /*** Get Fine Tune Setting ***/
  9.  i = *cptr & 15;       /* 00001111 make 4bit int      */
  10.  if ((i&8) == 8)       /* 00001000 check sign bit     */
  11.     i = i - 16;        /* Seems to convert right ?    */
  12.  inst->F_Tune = i;     /* Store Fine tune value       */
  13.  cptr += 1;
  14.  
  15.  /*** Get Instrament Volume ***/
  16.  inst->Vol =  *cptr;   /* Store volume                */
  17.  cptr += 1;
  18.  
  19.  /*** Get Repeat values ***/
  20.  inst->R_Start = Con_Word(cptr);  /* correct repeat start word  */
  21.  cptr +=2;
  22.  inst->R_Len   = Con_Word(cptr);  /* correct repeat lenght word */
  23.  cptr +=2;
  24. };
  25.  
  26. /*********
  27.  *********/
  28. void Read_Track(struct S_Track *track, int handle)
  29. /*  This function reads ONE track and stores it into structure
  30.  pointed to by track. */
  31. {
  32.  int count,      /* counting variable */
  33.      i;          /* Temporary integer */
  34.  
  35.  
  36.  for (count = 0 ; count < MAXNOTES ; count++)
  37.    {
  38.        for ( i = 0 ; i < MAXCHAN ; i++)
  39.   {
  40.    Read_Note(&track->Note[count].Chan[i] ,handle);
  41.    /* due to current limits, channel is 0 only, should be i */
  42.   };
  43.    };
  44. };
  45. /*********
  46.  *********/
  47.  
  48. char *Read_Samp(struct S_Inst *inst, char *m_ptr)
  49. /* This function finds the sample and sets the instrament pointer to it. It retu
  50. rns a pointer to the next sample. */
  51. {
  52.  char *ptr;
  53.  
  54.  inst->Samp = m_ptr;
  55.  ptr = m_ptr + inst->Len;
  56.  return(ptr);
  57. };
  58.  
  59. /*********
  60.  *********/
  61.  
  62. int Load_Song(char *name, struct S_Mod *mod2)
  63. /*  This function loads a file indicated by name, into the mod
  64. structure. */
  65. {
  66.   int handle;         /* file handle number  */
  67.   long int file_size; /* file size      */
  68.   char *fptr;         /* file buffer pointer */
  69.   char *ptr;          /* temporary pointer   */
  70.   char *t, *t2;
  71.   char test[2];
  72.   byte ta[134];
  73.   int c;              /* temporary counter   */
  74.  
  75.  
  76.   handle = _open(name,O_RDONLY|O_BINARY);/* Open Mod file
  77.          read only as binary */
  78.   if (handle == -1)
  79.     {
  80.       printf(" Error opening %s!\n",name);
  81.       exit(1);
  82.     };
  83.  
  84.   /* File opened ok.  Get info and alloc buffer memory */
  85.  
  86.   file_size = filelength(handle);
  87.   if (file_size == -1)
  88.     {
  89.       printf("Error finding %s's filelength.\n",name);
  90.       exit(1);
  91.     };
  92.  
  93.   /* Read file into buffer */
  94.  
  95.  * SLMR 2.1a * Beware of the opinion of someone without any facts.
  96.  
  97. --- SLMAIL v3.0  (#0272)
  98.  * Origin: Thunder Bay, Ontario, Canada (1:229/516)
  99. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  100. SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
  101. SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
  102.